﻿
using System;
using UnityEngine;
using UnityEngine.UI;

public class RoleAttrDlg:Dialog
{
    UIModelStudio _modelStudio;
    UIModel _uiModel;

    public RoleAttrDlg()
    {
       
        load("UI/System/RoleAttr/RoleAttrDlg");
        var modelArea = _root.Find<RectTransform>("RoleModel");
        var modelImage = _root.Find<RawImage>("RoleModel");
        var mainRole = RoleMgr.GetInstance().MainRole;
        if (mainRole == null) { Debug.LogError("未找到主角"); return; }
        _uiModel=UIModelMgr.GetInstance().CreateUIModel(
            (int)modelArea.rect.width,(int)modelArea.rect.height,modelImage,
            ResManager.GetInstance().load<GameObject>(mainRole.ModelPath));
        
    }
    protected override void onClose()
    {
        base.onClose();
        UIModelMgr.GetInstance().Release(_uiModel);
    }
}
